package top.fangw.admin.pojo.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;

import top.fangw.common.api.vo.InitApplicationVo;
import top.fangw.common.core.entity.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import top.fangw.common.core.entity.BaseTreeEntity;
import top.fangw.common.core.entity.TenantBaseTreeEntity;

/**
 * <p>
 * 用途：存储各个应用信息
 * </p>
 *
 * @author fangw
 * @since 2024-03-02
 */
@Getter
@Setter
@Accessors(chain = true)
@TableName("tbl_sys_application")
@Schema(name = "SysApplication", description = "用途：存储各个应用信息")
public class SysApplication extends BaseTreeEntity {


    @Schema(description = "系统简称")
    @TableField("sys_simple_name")
    private String sysSimpleName;

    @Schema(description = "显示顺序")
    @TableField("show_sort")
    private Integer showSort;

    @Schema(description = "是否显示0:不显示 1:显示")
    @TableField("show_flag")
    private String showFlag;

    @Schema(description = "系统呈现方式0:pc 1:微信小程序 2:android 3:IOS")
    @TableField("show_type")
    private String showType;

    @Schema(description = "是否为灰色模式0:不是 1:是")
    @TableField("is_gray")
    private String isGray;

    @Schema(description = "是否可删除0：可删除  1：不可删除")
    @TableField("is_deletable")
    private String isDeletable;

    @Schema(description = "系统说明")
    @TableField("description")
    private String description;

    @Schema(description = "系统默认地址")
    @TableField("sys_url")
    private String sysUrl;

    @Schema(description = "图标路径")
    @TableField("icon_url")
    private String iconUrl;

    @Schema(description = "租户id")
    @TableField("tenant_id")
    private String tenantId;

    public SysApplication build(InitApplicationVo initApplicationVo) {
        this.setId(initApplicationVo.getId());
        this.setName(initApplicationVo.getName());
        this.setParentId(initApplicationVo.getParentId());
        this.setParentIds(initApplicationVo.getParentIds());
        this.setParentNames(initApplicationVo.getParentNames());
        this.setTreeLeaf(initApplicationVo.getTreeLeaf());
        this.setTreeLevel(initApplicationVo.getTreeLevel());
        this.setSysSimpleName(initApplicationVo.getSysSimpleName());
        this.setShowSort(initApplicationVo.getShowSort());
        this.setShowFlag(initApplicationVo.getShowFlag());
        this.setShowType(initApplicationVo.getShowType());
        this.setIsGray(initApplicationVo.getIsGray());
        this.setIsDeletable(initApplicationVo.getIsDeletable());
        this.setDescription(initApplicationVo.getDescription());
        this.setSysUrl(initApplicationVo.getSysUrl());
        this.setIconUrl(initApplicationVo.getIconUrl());
        this.setTenantId(initApplicationVo.getTenantId());
        return this;
    }

}
